#!/usr/bin/env python3

import sys

sys.path.append("../lib")

from spread_sheet import Spreadsheet
from rich import print as rprint

FILES = [
    "./data/d.xlsx",
    "./data/c.xlsx",
    "./data/a.xlsx",
    "./data/b.xlsx",
]


def get_last_two():
    return FILES[-2:]


def diff_all():
    for i in range(len(FILES) - 1):
        old_file = FILES[i]
        new_file = FILES[i + 1]
        rprint("Diff", old_file, "VS", new_file)
        diff_two(old_file, new_file, "A3:M10")


def diff_two(old_file, new_file, range_str):
    old_spreadsheet = Spreadsheet(old_file)
    new_spreadsheet = Spreadsheet(new_file)

    single_mod_cells = old_spreadsheet.dry_diff(new_spreadsheet, range_str=range_str)
    rprint("Change", single_mod_cells)
    print("-------------------------------------")


def main():

    # old_file, new_file = get_last_two()
    # diff_two(old_file, new_file, "A3:M10")

    diff_all()

    pass


if __name__ == "__main__":
    main()
